package com.fkcai.hansoul.config;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@Data
public class OssConfig {
	@Value("${aliyun.oss.endpoint:#{'oss-cn-shenzhen.aliyuncs.com'}}")
	private String endpoint;
	@Value("${aliyun.oss.access-key-id:#{'your-access-key-id'}}")
	private String accessKeyId;
	@Value("${aliyun.oss.access-key-secret:#{'your-access-key-secret'}}")
	private String accessKeySecret;
	@Value("${aliyun.oss.bucket-name:#{'han-soul'}}")
	private String bucketName;
	@Value("${aliyun.oss.region:#{'cn-shenzhen'}}")
	private String region;
	
	@Bean
	public OSS ossClient() {
		return new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
	}
	
	@Bean
	public String bucketName() {
		return bucketName;
	}
	
}